﻿using System;
using System.Linq;

class MaximumSum
{
    static void Main()
    {
        Console.Write("Number of elements of array:");
        int arrayLength = int.Parse(Console.ReadLine());
        int[] array = new int[arrayLength];
        for (int i = 0; i < array.Length; i++)
        {
            Console.Write("\nInt element a[{0}]:", i);
            array[i] = int.Parse(Console.ReadLine());
        }

        Console.Write("Number of elements for a maximum sum:");
        int numberElements = int.Parse(Console.ReadLine());

        Array.Sort(array);

        int maximumSum = array[array.Length - numberElements];
        Console.Write("Elements with maximum sum are: " + array[array.Length - numberElements]);
        for (int i = array.Length - numberElements + 1; i < array.Length; i++)
        {
            Console.Write("+" + array[i]);
            maximumSum += array[i];
        }
        Console.Write("=" + maximumSum);
        Console.WriteLine();
    }
}